<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateQhUserLearnTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('qh_user_learn', function (Blueprint $table) {
            $table->id();
            $table->integer('userId', false, true)->comment('用户ID');
            $table->integer('qlId', false, true)->nullable()->comment('题库ID');
            $table->integer('courseId', false, true)->nullable()->comment('学科ID');
            $table->integer('knowledgeId', false, true)->nullable()->comment('二级知识点ID');
            $table->integer('qCount')->default(0)->comment('已学习试题数量');
            $table->timestamps();
        });
        DB::statement("ALTER TABLE qh_user_learn comment '用户正在学习'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('qh_user_learn');
    }
}
